﻿<%@ Page Title="" Language="C#" MasterPageFile="~/HRSys.Master" AutoEventWireup="true"
    CodeBehind="AuditLeave.aspx.cs" Inherits="HRWebSite.Employee.AuditLeave" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<title id="Title1" runat="server" title="假期审核"></title>
    <script type="text/javascript" src="../Scripts/jquery-1.4.2.js"></script>
    <script type="text/javascript">

        $(document).ready(function () {
            $(":checkbox[name='auditPass']").click(function (event) {
                $(event.target).parent().next().children().attr('checked',!$(event.target).attr('checked'));
            });
            $(":checkbox[name='auditFail']").click(function (event) {
                $(event.target).parent().prev().children().attr('checked',!$(event.target).attr('checked'));
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table>
        <tr>
            <td class="td-odd">
                选择类型
            </td>
            <td class="td-even">
                <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal"
                    AutoPostBack="True">
                    <asp:ListItem Value="0" Selected="True">未审核</asp:ListItem>
                    <asp:ListItem Value="1">未通过</asp:ListItem>
                    <asp:ListItem Value="2">通过</asp:ListItem>
                </asp:RadioButtonList>
            </td>
            <td class="td-but" colspan="2">
                <asp:Button ID="Button1" runat="server" Text="审核" OnClick="Button1_Click" />
            </td>
        </tr>
    </table>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"
        DataKeyNames="HolidyID" DataSourceID="SqlDataSource1" ForeColor="#333333">
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:BoundField DataField="uname" HeaderText="姓名" SortExpression="uname" />
            <asp:BoundField DataField="Start" HeaderText="开始时间" SortExpression="Start" />
            <asp:BoundField DataField="End" HeaderText="结束时间" SortExpression="End" />
            <asp:BoundField DataField="Name" HeaderText="类型" SortExpression="Name" />
            <asp:BoundField DataField="Audit" HeaderText="审核人" SortExpression="Audit" />
            <asp:TemplateField HeaderText="状态" SortExpression="state">
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# GetState(Eval("state").ToString()) %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="审核">
                <ItemTemplate>
                    <label>
                        <input type="checkbox" name="auditPass" value='<%#Eval("HolidyID")%>' <%#Eval("state").ToString()=="2"?"checked":"" %>
                            <%#Eval("state").ToString()=="0"?"":"disabled" %> />通过</label>
                    <label>                        
                        <input type="checkbox" name="auditFail" value='<%#Eval("HolidyID")%>' <%#Eval("state").ToString()=="1"?"checked":"" %>
                            <%#Eval("state").ToString()=="0"?"":"disabled" %> />未通过</label>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <EditRowStyle BackColor="#2461BF" />
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#EFF3FB" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#F5F7FB" />
        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
        <SortedDescendingCellStyle BackColor="#E9EBEF" />
        <SortedDescendingHeaderStyle BackColor="#4870BE" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:HRSys %>"
        SelectCommand="SELECT * FROM [HolidyView] WHERE ([state] = @state AND NumberID!=@numberid)">
        <SelectParameters>
            <asp:ControlParameter ControlID="RadioButtonList1" Name="state" PropertyName="SelectedValue"
                Type="Int32" />
                <asp:SessionParameter Name="numberid" Type="String" SessionField="Audit_NumberID" />
        </SelectParameters>
    </asp:SqlDataSource>
</asp:Content>
